﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HuginApiAddonsCS.I_DID;
using HuginApiAddonsCS.Policy;
using HuginApiAddonsCS.Policy.Learning;

namespace HuginApiAddonsTestCS.Programs
{
    public class LearnTreeUnknown: IProgram
    {
        #region IProgram Members

        public void ExecuteProgram(string[] args)
        {
            if (args.Count() > 7)
            {
                string obsCol = args[1];
                List<string> observations = args[2].Split(',').ToList();
                string actionCol = args[3];
                int maxHorizon = Convert.ToInt32(args[4]);
                string outputFolder = args[5];
                PolicyType pType = (PolicyType)Enum.Parse(typeof(PolicyType), args[6]);
                List<string> inputFiles = new List<string>();

                for (int i = 7; i < args.Count(); i++)
                {
                    inputFiles.Add(args[i]);
                }

                PolicyTreeLearner learner = new PolicyTreeLearner();
                learner.LearnFromUnknownHorizonHistories(inputFiles, obsCol, actionCol, observations, maxHorizon);
            }
            else
            {
                Console.WriteLine("Invalid Parameters");
                Console.WriteLine("Press any key to continue ...");
                Console.ReadKey();
            }
        }

        public string[] GetCommandOptions()
        {
            string[] options =
            {
                "[input file] [obs col] [observations] [act col] [max horizon] [output folder] [output type] [input files]"
            };

            return options;
        }

        #endregion
    }
}
